package com.example.moonshine.redchange.Activity;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Looper;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.moonshine.redchange.Data.ChangeDate;
import com.example.moonshine.redchange.Data.ChangedataData;
import com.example.moonshine.redchange.Data.OidData;
import com.example.moonshine.redchange.Data.SelectOid;
import com.example.moonshine.redchange.Helper.DataDBHepler;
import com.example.moonshine.redchange.R;
import com.google.gson.Gson;
import com.zyao89.view.zloading.ZLoadingDialog;

import java.io.IOException;
import java.util.ArrayList;

import okhttp3.FormBody;
import okhttp3.MediaType;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;

import static android.content.ContentValues.TAG;
import static com.zyao89.view.zloading.Z_TYPE.CIRCLE;

/**
 * Created by moonshine on 2018/4/25.
 */

@SuppressLint("Registered")
public class temchangetwoActivity extends Activity {

    String bottom_dry_thickness;//底漆干膜厚度
    String bottom_dry_thickness_d;//底漆干膜厚度误差
    String bottom_dry_thickness_d_l;//底漆干膜厚度测量左
    String bottom_dry_thickness_d_r;//底漆干膜厚度测量右


    String bottom_wet_thickness;//底漆湿膜厚度
    String bottom_wet_thickness_d;//底漆湿膜厚度误差
    String bottom_wet_thickness_d_l;//底漆湿膜厚度修正左
    String bottom_wet_thickness_d_r;//底漆湿膜厚度修正右

    String back_dry_thickness;//背漆干膜厚度
    String back_dry_thickness_d;//背漆干膜厚度误差
    String back_dry_thickness_d_l;//背漆干膜厚度修正左
    String back_dry_thickness_d_r;//背漆干膜厚度修正右

    String back_wet_thickness;//背漆湿膜厚度
    String back_wet_thickness_d;//背漆湿膜厚度误差
    String back_wet_thickness_d_l;//背漆湿膜厚度修正左
    String back_wet_thickness_d_r;//背漆湿膜厚度修正右

    String surface_dry_thickness;//面漆干膜厚度
    String surface_dry_thickness_d;//面漆干膜厚度误差
    String surface_dry_thickness_d_l;//面漆干膜厚度修正左
    String surface_dry_thickness_d_r;//面漆干膜厚度修正右

    String surface_wet_thickness;//面漆湿膜厚度
    String surface_wet_thickness_d;//面漆湿膜厚度误差
    String surface_wet_thickness_d_l;//面漆湿膜厚度修正左
    String surface_wet_thickness_d_r;//面漆湿膜厚度修正右

    String data_pack_time;//工艺包修改时间
    String plate_thickness;//铝板厚度
    String plate_width;//铝板宽度
    String plate_length;//铝板长度

    String temperature_1_1;//一涂一区温度
    String temperature_1_1_d;//一涂一区温度差值
    String temperature_1_2;//一涂二区温度
    String temperature_1_2_d;//一涂二区温度差值
    String temperature_1_3;//一涂三区温度
    String temperature_1_3_d;//一涂三区温度差值
    String temperature_1_4;//一涂四区温度
    String temperature_1_4_d;//一涂四区温度差值
    String temperature_1_5;//一涂五区温度
    String temperature_1_5_d;//一涂五区温度差值

    String temperature_2_1;//二涂一区温度
    String temperature_2_1_d;//二涂一区温度差值
    String temperature_2_2;//二涂二区温度
    String temperature_2_2_d;//二涂二区温度差值
    String temperature_2_3;//二涂三区温度
    String temperature_2_3_d;//二涂三区温度差值
    String temperature_2_4;//二涂四区温度
    String temperature_2_4_d;//二涂四区温度差值
    String temperature_2_5;//二涂五区温度
    String temperature_2_5_d;//二涂五区温度差值

    String exhaust_air_volume_1;//一涂排气风量
    String exhaust_air_volume_1_d;//一涂排气风量差值
    String exhaust_air_volume_2;//二涂排气风量
    String exhaust_air_volume_2_d;//二涂排气风量差值


    ImageView second_image_left_one;
    ImageView second_image_left_two;
    ImageView second_image_left_three;
    ImageView second_image_left_four;
    ImageView second_image_left_five;

    ImageView second_image_right_one;
    ImageView second_image_right_two;
    ImageView second_image_right_three;
    ImageView second_image_right_four;
    ImageView second_image_right_five;

    ImageView second_image_left_one1;
    ImageView second_image_left_two1;
    ImageView second_image_left_three1;
    ImageView second_image_left_four1;
    ImageView second_image_left_five1;

    ImageView second_image_right_one1;
    ImageView second_image_right_two1;
    ImageView second_image_right_three1;
    ImageView second_image_right_four1;
    ImageView second_image_right_five1;

    TextView second_data_one;
    TextView second_data_two;
    TextView second_data_three;
    TextView second_data_four;
    TextView second_data_five;

    TextView second_data_one1;
    TextView second_data_two1;
    TextView second_data_three1;
    TextView second_data_four1;
    TextView second_data_five1;

    TextView second_get_data_one;
    TextView second_get_data_two;
    TextView second_get_data_three;
    TextView second_get_data_four;
    TextView second_get_data_five;

    TextView second_get_data_one1;
    TextView second_get_data_two1;
    TextView second_get_data_three1;
    TextView second_get_data_four1;
    TextView second_get_data_five1;

    Button btn;
    String order_id;
    ZLoadingDialog dialog = new ZLoadingDialog(temchangetwoActivity.this);
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.changetem1);
        initview();
        runview();
        order_id = selectOid();
        second_image_left_one.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_one.getText()));
                String result = String.valueOf(data + i);
                second_data_one.setText(result);
            }
        });

        second_image_right_one.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_one.getText()));
                String result = String.valueOf(data - i);
                second_data_one.setText(result);
            }
        });

        second_image_left_two.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_two.getText()));
                String result = String.valueOf(data + i);
                second_data_two.setText(result);
            }
        });

        second_image_right_two.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_two.getText()));
                String result = String.valueOf(data - i);
                second_data_two.setText(result);
            }
        });

        second_image_left_three.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_three.getText()));
                String result = String.valueOf(data + i);
                second_data_three.setText(result);
            }
        });

        second_image_right_three.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_three.getText()));
                String result = String.valueOf(data - i);
                second_data_three.setText(result);
            }
        });

        second_image_left_four.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_four.getText()));
                String result = String.valueOf(data + i);
                second_data_four.setText(result);
            }
        });

        second_image_right_four.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_four.getText()));
                String result = String.valueOf(data - i);
                second_data_four.setText(result);
            }
        });
        second_image_left_five.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_five.getText()));
                String result = String.valueOf(data + i);
                second_data_five.setText(result);
            }
        });

        second_image_right_five.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_five.getText()));
                String result = String.valueOf(data - i);
                second_data_five.setText(result);
            }
        });


        second_image_left_one1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_one1.getText()));
                String result = String.valueOf(data + i);
                second_data_one1.setText(result);
            }
        });

        second_image_right_one1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_one1.getText()));
                String result = String.valueOf(data - i);
                second_data_one1.setText(result);
            }
        });

        second_image_left_two1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_two1.getText()));
                String result = String.valueOf(data + i);
                second_data_two1.setText(result);
            }
        });

        second_image_right_two1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_two1.getText()));
                String result = String.valueOf(data - i);
                second_data_two1.setText(result);
            }
        });

        second_image_left_three1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_three1.getText()));
                String result = String.valueOf(data + i);
                second_data_three1.setText(result);
            }
        });

        second_image_right_three1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_three1.getText()));
                String result = String.valueOf(data - i);
                second_data_three1.setText(result);
            }
        });

        second_image_left_four1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_four1.getText()));
                String result = String.valueOf(data + i);
                second_data_four1.setText(result);
            }
        });

        second_image_right_four1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_four1.getText()));
                String result = String.valueOf(data - i);
                second_data_four1.setText(result);
            }
        });
        second_image_left_five1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_five1.getText()));
                String result = String.valueOf(data + i);
                second_data_five1.setText(result);
            }
        });

        second_image_right_five1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                int i = 1;
                int data = Integer.parseInt(String.valueOf(second_data_five1.getText()));
                String result = String.valueOf(data - i);
                second_data_five1.setText(result);
            }
        });


        btn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {

                dialog.setLoadingBuilder(CIRCLE)//设置类型
                        .setLoadingColor(Color.GREEN)//颜色
                        .setHintText("上传中...")
                        .setHintTextSize(16) // 设置字体大小 dp
                        .setHintTextColor(Color.GREEN)  // 设置字体颜色
                        .setDurationTime(0.5) // 设置动画时间百分比 - 0.5倍
//                        .setDialogBackgroundColor(Color.parseColor("#CC111111")) // 设置背景色，默认白色
                        .setCanceledOnTouchOutside(false)
                        .show();

                final String temone = String.valueOf(second_data_one.getText());
                final String temone1 = String.valueOf(second_data_one1.getText());
                final String temtwo= String.valueOf(second_data_two.getText());
                final String temtwo1 = String.valueOf(second_data_two1.getText());
                final String temthree = String.valueOf(second_data_three.getText());
                final String temthree1 = String.valueOf(second_data_three1.getText());
                final String temfour = String.valueOf(second_data_four.getText());
                final String temfour1 = String.valueOf(second_data_four1.getText());
                final String temfive = String.valueOf(second_data_five.getText());
                final String temfive1 = String.valueOf(second_data_five1.getText());
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        Looper.prepare();
                        try {
                            String result =postChangeDateHttp(order_id,data_pack_time, plate_thickness, plate_width, plate_length,
                                    bottom_dry_thickness, bottom_dry_thickness_d, bottom_dry_thickness_d_l, bottom_dry_thickness_d_r,
                                    bottom_wet_thickness, bottom_wet_thickness_d, bottom_wet_thickness_d_l, bottom_wet_thickness_d_r,
                                    back_dry_thickness, back_dry_thickness_d, back_dry_thickness_d_l, back_dry_thickness_d_r,
                                    back_wet_thickness, back_wet_thickness_d, back_wet_thickness_d_l, back_wet_thickness_d_r,
                                    surface_dry_thickness, surface_dry_thickness_d, surface_dry_thickness_d_l, surface_dry_thickness_d_r,
                                    surface_wet_thickness, surface_wet_thickness_d, surface_wet_thickness_d_l, surface_wet_thickness_d_r,
                                    temperature_1_1, temperature_1_1_d, temperature_1_2, temperature_1_2_d, temperature_1_3, temperature_1_3_d, temperature_1_4, temperature_1_4_d, temperature_1_5, temperature_1_5_d,
                                    temone, temone1, temtwo, temtwo1, temthree,temthree1, temfour, temfour1, temfive, temfive1,
                                    exhaust_air_volume_1, exhaust_air_volume_1_d, exhaust_air_volume_2, exhaust_air_volume_2_d);
                            if(result.equals("10"))
                            {
                                dialog.dismiss();
                                Intent intent = new Intent();
                                intent.putExtra("index","1");
                                intent.setClass(temchangetwoActivity.this,SuccessActivity.class);
                                startActivity(intent);
                                finish();
                            }
                            else {
                                dialog.dismiss();
                                Toast.makeText(getApplicationContext(),"提交失败，请重试",Toast.LENGTH_SHORT).show();
                            }
                        }catch (Exception e)
                        {
                            dialog.dismiss();
                            e.printStackTrace();
                            Toast.makeText(getApplicationContext(),"网络故障",Toast.LENGTH_SHORT).show();
                        }
                        dialog.dismiss();
                        Looper.loop();
                    }
                }).start();
            }
        });

    }

    @SuppressLint("CutPasteId")
    public void initview() {
        btn = findViewById(R.id.tem_sureren);
        second_image_left_one = findViewById(R.id.second_image_left_one);
        second_image_left_two = findViewById(R.id.second_image_left_two);
        second_image_left_three = findViewById(R.id.second_image_left_three);
        second_image_left_four = findViewById(R.id.second_image_left_four);
        second_image_left_five = findViewById(R.id.second_image_left_five);

        second_image_right_one = findViewById(R.id.second_image_right_one);
        second_image_right_two = findViewById(R.id.second_image_right_two);
        second_image_right_three = findViewById(R.id.second_image_right_three);
        second_image_right_four = findViewById(R.id.second_image_right_four);
        second_image_right_five = findViewById(R.id.second_image_right_five);

        second_image_left_one1 = findViewById(R.id.second_image_left_one1);
        second_image_left_two1 = findViewById(R.id.second_image_left_two1);
        second_image_left_three1 = findViewById(R.id.second_image_left_three1);
        second_image_left_four1 = findViewById(R.id.second_image_left_four1);
        second_image_left_five1 = findViewById(R.id.second_image_left_five1);

        second_image_right_one1 = findViewById(R.id.second_image_right_one1);
        second_image_right_two1 = findViewById(R.id.second_image_right_two1);
        second_image_right_three1 = findViewById(R.id.second_image_right_three1);
        second_image_right_four1 = findViewById(R.id.second_image_right_four1);
        second_image_right_five1 = findViewById(R.id.second_image_right_five1);

        second_data_one = findViewById(R.id.second_data_one);
        second_data_two = findViewById(R.id.second_data_two);
        second_data_three = findViewById(R.id.second_data_three);
        second_data_four = findViewById(R.id.second_data_four);
        second_data_five = findViewById(R.id.second_data_five);

        second_data_one1 = findViewById(R.id.second_data_one1);
        second_data_two1 = findViewById(R.id.second_data_two1);
        second_data_three1 = findViewById(R.id.second_data_three1);
        second_data_four1 = findViewById(R.id.second_data_four1);
        second_data_five1 = findViewById(R.id.second_data_five1);

        second_get_data_one = findViewById(R.id.second_get_data_one);
        second_get_data_two = findViewById(R.id.second_get_data_two);
        second_get_data_three = findViewById(R.id.second_get_data_three);
        second_get_data_four = findViewById(R.id.second_get_data_four);
        second_get_data_five = findViewById(R.id.second_get_data_five);

        second_get_data_one1 = findViewById(R.id.second_get_data_one1);
        second_get_data_two1 = findViewById(R.id.second_get_data_two1);
        second_get_data_three1 = findViewById(R.id.second_get_data_three1);
        second_get_data_four1 = findViewById(R.id.second_get_data_four1);
        second_get_data_five1 = findViewById(R.id.second_get_data_five1);
    }
    public  void runview(){
        new Thread(new Runnable() {
            @Override
            public void run() {
                new AnotherTask().execute("");
//                getChangeDatehttp();
            }
        }).start();
    }
    @SuppressLint("StaticFieldLeak")
    private class AnotherTask extends AsyncTask<String, Void, String> {
        @Override
        protected void onPostExecute(String result) {
            //对UI组件的更新操作
            Gson gson = new Gson();
            ChangeDate changeData = gson.fromJson(result, ChangeDate.class);
            ChangedataData changedataData = changeData.getData();
            back_dry_thickness = changedataData.getBack_dry_thickness();
            back_dry_thickness_d = changedataData.getBack_dry_thickness_d();
            back_dry_thickness_d_l = changedataData.getBack_dry_thickness_d_l();
            back_dry_thickness_d_r = changedataData.getBack_dry_thickness_d_r();
            back_wet_thickness = changedataData.getBack_wet_thickness();
            back_wet_thickness_d = changedataData.getBack_wet_thickness_d();
            back_wet_thickness_d_l = changedataData.getBack_wet_thickness_d_l();
            back_wet_thickness_d_r = changedataData.getBack_wet_thickness_d_r();
            bottom_dry_thickness = changedataData.getBottom_dry_thickness();
            bottom_dry_thickness_d = changedataData.getBottom_dry_thickness_d();
            bottom_dry_thickness_d_l = changedataData.getBottom_dry_thickness_d_l();
            bottom_dry_thickness_d_r = changedataData.getBottom_dry_thickness_d_r();
            bottom_wet_thickness = changedataData.getBottom_wet_thickness();
            bottom_wet_thickness_d = changedataData.getBottom_wet_thickness_d();
            bottom_wet_thickness_d_l = changedataData.getBottom_wet_thickness_d_l();
            bottom_wet_thickness_d_r = changedataData.getBottom_wet_thickness_d_r();
            surface_dry_thickness = changedataData.getSurface_dry_thickness();
            surface_dry_thickness_d = changedataData.getSurface_dry_thickness_d();
            surface_dry_thickness_d_l = changedataData.getSurface_dry_thickness_d_l();
            surface_dry_thickness_d_r = changedataData.getSurface_dry_thickness_d_r();
            surface_dry_thickness_d_l = changedataData.getSurface_dry_thickness_d_l();
            surface_wet_thickness = changedataData.getSurface_wet_thickness();
            surface_wet_thickness_d = changedataData.getSurface_wet_thickness_d();
            surface_wet_thickness_d_r = changedataData.getSurface_wet_thickness_d_r();
            surface_wet_thickness_d_l = changedataData.getSurface_dry_thickness_d_r();

            data_pack_time = changedataData.getData_pack_time();
            plate_length = changedataData.getPlate_length();
            plate_thickness = changedataData.getPlate_thickness();
            plate_width = changedataData.getPlate_width();

            temperature_1_1 = changedataData.getTemperature_1_1();
            temperature_1_1_d = changedataData.getTemperature_1_1_d();
            temperature_1_2 = changedataData.getTemperature_1_2();
            temperature_1_2_d = changedataData.getTemperature_1_2_d();
            temperature_1_3 = changedataData.getTemperature_1_3();
            temperature_1_3_d = changedataData.getTemperature_1_3_d();
            temperature_1_4 = changedataData.getTemperature_1_4();
            temperature_1_4_d = changedataData.getTemperature_1_4_d();
            temperature_1_5 = changedataData.getTemperature_1_5();
            temperature_1_5_d = changedataData.getTemperature_1_5_d();
            temperature_2_1 = changedataData.getTemperature_2_1();
            temperature_2_1_d = changedataData.getTemperature_2_1_d();
            temperature_2_2 = changedataData.getTemperature_2_2();
            temperature_2_2_d = changedataData.getTemperature_2_2_d();
            temperature_2_3 = changedataData.getTemperature_2_3();
            temperature_2_3_d = changedataData.getTemperature_2_3_d();
            temperature_2_4 = changedataData.getTemperature_2_4();
            temperature_2_4_d = changedataData.getTemperature_2_4_d();
            temperature_2_5 = changedataData.getTemperature_2_5();
            temperature_2_5_d = changedataData.getTemperature_2_5_d();

            exhaust_air_volume_1 = changedataData.getExhaust_air_volume_1();
            exhaust_air_volume_1_d = changedataData.getExhaust_air_volume_1_d();
            exhaust_air_volume_2 = changedataData.getExhaust_air_volume_2();
            exhaust_air_volume_2_d = changedataData.getExhaust_air_volume_2_d();

            second_get_data_one.setText(temperature_2_1);
            second_get_data_one1.setText(temperature_2_1_d);
            second_get_data_two.setText(temperature_2_2);
            second_get_data_two1.setText(temperature_2_2_d);
            second_get_data_three.setText(temperature_2_3);
            second_get_data_three1.setText(temperature_2_3_d);
            second_get_data_four.setText(temperature_2_4);
            second_get_data_four1.setText(temperature_2_4_d);
            second_get_data_five.setText(temperature_2_5);
            second_get_data_five1.setText(temperature_2_5_d);

            second_data_one.setText(temperature_2_1);
            second_data_one1.setText(temperature_2_1_d);
            second_data_two.setText(temperature_2_2);
            second_data_two1.setText(temperature_2_2_d);
            second_data_three.setText(temperature_2_3);
            second_data_three1.setText(temperature_2_3_d);
            second_data_four.setText(temperature_2_4);
            second_data_four1.setText(temperature_2_4_d);
            second_data_five.setText(temperature_2_5);
            second_data_five1.setText(temperature_2_5_d);
        }

        @Override
        protected String doInBackground(String... params) {
            //耗时的操作
            String url = "http://119.23.219.22:80/element-admin/technics/product-data-query";
            OkHttpClient client = new OkHttpClient();
            Gson gson = new Gson();
            OidData data = new OidData();
            data.setOid(selectOid());
            String json = gson.toJson(data);
            MediaType JSON = MediaType.parse("application/json; charset=utf-8");
            RequestBody requestBody = FormBody.create(JSON, json);
            Request request = new Request.Builder()
                    .url(url)
                    .post(requestBody)
                    .build();
            String result = null;
            try {
                Response response = client.newCall(request).execute();
                result = response.body().string();

            } catch (IOException e) {
                e.printStackTrace();
                Log.e(TAG, "doInBackground: ", e);
            }
            return result;
        }

    }

    public String postChangeDateHttp(String order_id,String data_pack_time, String plate_thickness, String plate_width, String plate_length,
                                     String bottom_dry_thickness, String bottom_dry_thickness_d, String bottom_dry_thickness_d_l, String bottom_dry_thickness_d_r,
                                     String bottom_wet_thickness, String bottom_wet_thickness_d, String bottom_wet_thickness_d_l, String bottom_wet_thickness_d_r,
                                     String back_dry_thickness, String back_dry_thickness_d, String back_dry_thickness_d_l, String back_dry_thickness_d_r,
                                     String back_wet_thickness, String back_wet_thickness_d, String back_wet_thickness_d_l, String back_wet_thickness_d_r,
                                     String surface_dry_thickness, String surface_dry_thickness_d, String surface_dry_thickness_d_l, String surface_dry_thickness_d_r,
                                     String surface_wet_thickness, String surface_wet_thickness_d, String surface_wet_thickness_d_l, String surface_wet_thickness_d_r,
                                     String temperature_1_1, String temperature_1_1_d, String temperature_1_2, String temperature_1_2_d, String temperature_1_3, String temperature_1_3_d,
                                     String temperature_1_4, String temperature_1_4_d, String temperature_1_5, String temperature_1_5_d, String temperature_2_1, String temperature_2_1_d,
                                     String temperature_2_2, String temperature_2_2_d, String temperature_2_3, String temperature_2_3_d, String temperature_2_4, String temperature_2_4_d,
                                     String temperature_2_5, String temperature_2_5_d, String exhaust_air_volume_1, String exhaust_air_volume_1_d, String exhaust_air_volume_2, String exhaust_air_volume_2_d) {
        String status1 = "";
        String url = "http://119.23.219.22:80/element-admin/technics/product-data-alert";
        OkHttpClient client = new OkHttpClient();
        Gson gson = new Gson();
        ChangedataData data = new ChangedataData(order_id,data_pack_time, plate_thickness, plate_width, plate_length,
                bottom_dry_thickness, bottom_dry_thickness_d, bottom_dry_thickness_d_l, bottom_dry_thickness_d_r,
                bottom_wet_thickness, bottom_wet_thickness_d, bottom_wet_thickness_d_l, bottom_wet_thickness_d_r,
                back_dry_thickness, back_dry_thickness_d, back_dry_thickness_d_l, back_dry_thickness_d_r,
                back_wet_thickness, back_wet_thickness_d, back_wet_thickness_d_l, back_wet_thickness_d_r,
                surface_dry_thickness, surface_dry_thickness_d, surface_dry_thickness_d_l, surface_dry_thickness_d_r,
                surface_wet_thickness, surface_wet_thickness_d, surface_wet_thickness_d_l, surface_wet_thickness_d_r,
                temperature_1_1, temperature_1_1_d, temperature_1_2, temperature_1_2_d, temperature_1_3, temperature_1_3_d,
                temperature_1_4, temperature_1_4_d, temperature_1_5, temperature_1_5_d, temperature_2_1, temperature_2_1_d,
                temperature_2_2, temperature_2_2_d, temperature_2_3, temperature_2_3_d, temperature_2_4, temperature_2_4_d,
                temperature_2_5, temperature_2_5_d, exhaust_air_volume_1, exhaust_air_volume_1_d, exhaust_air_volume_2, exhaust_air_volume_2_d);
        String json = gson.toJson(data);
        MediaType JSON = MediaType.parse("application/json; charset=utf-8");
        RequestBody requestBody = FormBody.create(JSON, json);
        Request request = new Request.Builder()
                .url(url)
                .post(requestBody)
                .build();
        try {
            Response response = client.newCall(request).execute();
            String result = response.body().string();
            ChangeDate changeDate = gson.fromJson(result, ChangeDate.class);
            status1 = changeDate.getStatus();
        } catch (Exception e) {
            e.printStackTrace();
            Toast.makeText(getApplicationContext(), "网络异常", Toast.LENGTH_SHORT).show();
        }
        return status1;
    }
    public String selectOid() {
        DataDBHepler dataDBHepler = new DataDBHepler(getBaseContext());
        ArrayList<SelectOid> DataList = dataDBHepler.FindOidData();
        final SelectOid data = new SelectOid(DataList.get(0).getId(), DataList.get(0).getOid());
        Log.i(TAG, "数据库的Oid为：" + data.getOid());
        final String Oid = data.getOid();
        return Oid;
    }

//    /**
//     * @param keyCode
//     * @param event   监听手机back键 点击返回界面
//     * @return
//     */
//    public boolean onKeyDown(int keyCode, KeyEvent event) {
//
//        if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
//            //启动一个意图,回到桌面
//            Intent intent = new Intent();
//            intent.putExtra("index", "1");
//            intent.setClass(temchangetwoActivity.this, MaintwoActivity.class);
//            startActivity(intent);
//            finish();
//            return true;
//        }
//        return super.onKeyDown(keyCode, event);
//    }
}
